package com.servlet;

import com.Imp.OManagementMapperImpl;
import com.entity.OManagement;
import com.mapper.OManagementMapper;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class AllocationController extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        //获取订单号
        int orderId= Integer.parseInt(request.getParameter("orderId"));
        //获取配送员账号
        String deliverymanId = request.getParameter("deliverymanId");

        OManagementMapper OManagementMapper = new OManagementMapperImpl();
        OManagement OManagement = OManagementMapper.getOrdersByorderId(orderId);
        OManagement.setOrderState("配送中");
        OManagement.setDeliveryId(deliverymanId);
        OManagementMapper.updateOrder(OManagement);
        response.sendRedirect("orderAllocation.jsp");
    }

    public void  doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException{

    }

}
